package com.huashi.dealer.commonEntity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;

/**
 * 轮播图实体类
 */
@Getter
@Setter
@Schema(description = "轮播图实体")
public class SettingBanner extends BaseModel {

    @TableId(value = "id", type = IdType.AUTO)
    @Schema(description = "轮播图ID")
    private Long id;

    @TableField("name")
    @Schema(description = "名称")
    private String name;

    @TableField("image_id")
    @Schema(description = "轮播图片ID")
    private Integer imageId;

    @TableField("url")
    @Schema(description = "链接")
    private String url;

    @TableField("status")
    @Schema(description = "状态：10显示，20隐藏")
    private Integer status;

    @TableField("is_delete")
    @TableLogic
    @Schema(description = "软删除标记")
    private Integer isDelete;

    @TableField("create_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Schema(description = "创建时间")
    private Long createTime;

    @TableField("update_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Schema(description = "更新时间")
    private Long updateTime;

    @TableField(exist = false)
    @Schema(description = "图片地址")
    private String imageUrl;
    /**
     * 获取状态文本
     */
    @JsonProperty("statusText")
    public String getStatusText() {
        switch (status) {
            case 10: return "显示";
            case 20: return "隐藏";
            default: return "";
        }
    }
} 